/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package geneticprogramming.problem;

/**
 * The interface that all classes must implement to run through the genetic Algorithm.
 * One would pass the run method of the Genetic Algorthim a problem
 * @author CJ
 */
public interface GEProblem{


    /**
     * Returns an array of Individuals of a random population.
     * @param populationNum, size of array to return
     * @return Resulting random array
     */
    Individual[] getRandomPopulation(int populationNum);

    /**
     * Mutates an individual, does not have to be destructive, can return
     * the mutated individual.
     * @param individual to be mutated.
     * @return The mutated individual
     */
    Individual mutate(Individual individual);

    /**
     * Selects a random splice point and puts the two individuals into one.
     * @param invOne, First individual
     * @param invTwo, Second individual
     * @return The combination of the two individuals.
     */
    Individual mate(Individual invOne, Individual invTwo);

    /**
     * Returns the fitness of an individual. Should never be greater than maxFitness
     * @param individual to be measured
     * @return The fitness of the pass in individual.
     */
    double getFitness(Individual individual);

    /**
     * Returns the maximum fitness for an individual for this particular problem.
     * @return The fitness of the ideal individual.
     */
    double getPerfectFitness();

    /**
     *  Returns the desired mutations problem.  1/n is the probablility.
     * @param averageFitness
     * @return n, where n is above.
     */
    int getMutationProb(double averageFitness);

}
